package com.apes.enquiry.product.model;


import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.scm.masterdata.party.model.PartyRole;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 类描述：替换件关系管理
 *
 * @ClassName ReplacementProduct
 * @Description 描述
 * @Author lilong
 * @Date 2022/10/28 15:00
 * @Version 1.0
 */

@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = ReplacementProduct.CONST_TABLE_NAME)
public class ReplacementProduct extends Model {

    public static final String CONST_TABLE_NAME = "sp_mas_replacement_product";

    @Id
    @Column(name = "id", length = 8)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "id")
    @Comment("编号")
    private String id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "supplier_id", referencedColumnName = "id")
    @Comment("供应商")
    private PartyRole supplier;//供应商（商家）


    @Column(name = "replacement", length = 24)
    @Comment("替换件组件号")
    private String replacement;

    @Column(name = "pn", length = 80)
    @Comment("原厂零件号")
    private String pn;

    @Column(name = "brand", length = 80)
    @Comment("品牌")
    private String brand;


}
